# encoding: utf-8
#
#  ramdisk.py
#  xbayRAMDisk
#
#  Created by 黄 冬 on 08-1-1.
#  Copyright (c) 2008 __MyCompanyName__. All rights reserved.
#
import commands

def initRAMDisk(disksize):
    # 真实的大小是512byte * 2048
    realsize = disksize * 2048
    print("hdid -nomount ram://%s"%realsize)
    status,output = commands.getstatusoutput("hdid -nomount ram://%s"%realsize)
    return status,output

def newfs(diskname):
    print("newfs_hfs %s"%diskname)
    status,output = commands.getstatusoutput("newfs_hfs %s"%diskname)
    return status,output

def mountfs(diskname):
    print("diskutil mount %s"%(diskname))
    status,output = commands.getstatusoutput("diskutil mount %s"%(diskname))
    return status,output